<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

function timeval($time){
    $a= strtotime($time); //将格式化的时间转换为时间戳
    
    $b= time()-$a;
    $i=$b/86400;  //计算天
    $c=$b%86400;  //计算小时
    $e=$c%3600; //计算分钟
    $f=$e%60;   //计算秒
    if($i>1){
        return intval($i).'天前';
    }
    if(($c/3600)>1){
        return intval($c/3600).'小时前';
    }
    if(($c/3600)<1 and ($e/60)>1){
        return intval($e/60).'分钟前';
    }
    if(($e/60)<1){
        return intval($f).'秒前';
    }
}

function resess(){
    $session=session('user_id');
    return $session;
}
